package com.moonlight.demo.custom;

import java.nio.charset.Charset;

public class CustomPackage {
	// 包体总长度
	private int len;
	
	// 发送方式
	private byte type;
	
	// 发送内容
	private String content;
	
	public CustomPackage(byte type , String content) {
		this.len = 5 + content.getBytes(Charset.forName("utf-8")).length;
		this.type = type;
		this.content = content;
	}

	public int getLen() {
		return len;
	}

	public void setLen(int len) {
		this.len = len;
	}

	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Override
	public String toString() {
		return "CustomPackage [len=" + len + ", type=" + type + ", content=" + content + "]";
	}
}
